package com.twu.biblioteca.view;

import com.twu.biblioteca.model.menu.Command;

import java.util.HashMap;
import java.util.Map;

public abstract class UI {

    private final Map<Command, ViewAction> viewActions;

    protected UI() {
        this.viewActions = new HashMap<>();
    }

    public Map<Command, ViewAction> getViewActions() {
        return viewActions;
    }

    public abstract void showOptions();

    public abstract void welcome();

    public abstract Command getCommand();

    public abstract String[] getQuestionAnswers(Command command);

    public final void updateAfterAction(Command command, boolean success) {
        if (viewActions.containsKey(command)) {
            viewActions.get(command).update(success);
        }
    }


}
